package com.samphanie.common.utils;

import lombok.RequiredArgsConstructor;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @Author ZSY
 * @createTime 2021/9/10 19:18
 */
@Component
@RequiredArgsConstructor
public class SpringEnvironmentUtils {

    private final Environment environment;

    public String getLocalHostAddress() {
        String port = environment.getProperty("server.port");
        return "http://localhost" + ":" + port;
    }

    public String getApplicationName() {
        return environment.getProperty("spring.application.name");
    }

}
